﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace BDSim
{
    public class RinexFileDataType
    {
        #region 动态库通用数据
        /// <summary>
        /// 60字符
        /// </summary>
        public const int _MAX_RNX_MARK_NAME = 60;
        /// <summary>
        /// 60
        /// </summary>
        public const int _MAX_RNX_MARK_NUMBER = 60;
        /// <summary>
        /// 25
        /// </summary>
        public const int _MAX_RNX_RCVR_SN = 25;
        /// <summary>
        /// 25
        /// </summary>
        public const int _MAX_RNX_RCVR_TYPE = 25;
        /// <summary>
        /// 25
        /// </summary>
        public const int _MAX_RNX_RCVR_VER = 25;
        /// <summary>
        /// 25
        /// </summary>
        public const int _MAX_RNX_ANT_SN = 25;
        /// <summary>
        /// 25
        /// </summary>
        public const int _MAX_RNX_ANT_TYPE = 25;
        /// <summary>
        /// 30
        /// </summary>
        public const int _MAX_CNT_OBS_TYPE = 30;
        /// <summary>
        /// 500
        /// </summary>
        public const int _MAX_LEN_ONELINE = 500; 
        /// <summary>
        /// 80
        /// </summary>
        public const int _MAX_LEN_TEMP = 80;
        /// <summary>
        /// 100
        /// </summary>
        public const int _MAX_SAT_VISIBLE = 100;//
        /// <summary>
        /// 300
        /// </summary>
        public const int _MAX_SAT = 300;//
        /// <summary>
        /// 50
        /// </summary>
        public const int _MAX_SAT_SYSTEM = 50;
        /// <summary>
        /// 50
        /// </summary>
        public const int _MAX_SAT_ID = 50;
        /// <summary>
        /// 30
        /// </summary>
        public const int _MAX_CNT_OBS_TYPE_V302 = 30;
        /// <summary>
        /// 500
        /// </summary>
        public const int _MAX_STATION_NUMBER = 500;

        /// <summary>
        /// 月标记，1~12月
        /// </summary>
        public static string[] MonthEgsh = { "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
        #endregion

        #region 钟差数据
        /// <summary>
        /// 钟差文件头数据
        /// </summary>
        public struct ClkHead
        {
            //版本号
            public double Version;
            //创建本数据文件所采用程序的名称          
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 21)]
            public char[] Pgm;
            //机构  创建本数据文件单位的名称         
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 21)]
            public char[] agent;
            //创建本数据文件的日期
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 21)]
            public char[] CreateDate;
            //跳秒     
            public int LeapSeconds;
            //数据类型个数（站和卫星，这里只考虑卫星）      
            public int TypeNumber;
            //数据类型 ，AR，地面站钟差；AS，卫星钟差 
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 60)]
            public char[] DataType;
            //卫星数
            public int SatNumber;
            //卫星编号
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_SAT)]
            public int[] SatPRN;
            //系统类型--GPS用G表示 北斗用B表示
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_SAT)]
            public char[] SysType;
            //分析中心名
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 61)]
            public char[] AnalysisCenter;
            //地面站数量
            public int StationNumber;
            //地面站信息说明
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 51)]
            public char[] StationTRF;
            //地面站信息说明
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_STATION_NUMBER * 4)]
            public char[] StationName;
            /*地面站坐标--地固系，单位mm*/
            //x
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_STATION_NUMBER)]
            public double[] Station_X;
            //y
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_STATION_NUMBER)]
            public double[] Station_Y;
            //z
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_STATION_NUMBER)]
            public double[] Station_Z;

            public ClkHead(double version, int leapseconds, int typeNum)
            {
                Version = version;
                Pgm = new char[21];
                agent = new char[21];
                agent[0] = 'S';
                agent[1] = 'I';
                agent[2] = 'R';
                agent[3] = 'C';
                Pgm[0] = 'B';
                Pgm[1] = 'D';
                Pgm[2] = 'S';
                Pgm[3] = 'i';
                Pgm[4] = 'm';
                CreateDate = new char[21] ;
                LeapSeconds = leapseconds;
                TypeNumber = typeNum;
                DataType = new char[60];
                SatNumber = 0;
                SatPRN = new int[_MAX_SAT];
                SysType = new char[_MAX_SAT];
                AnalysisCenter = new char[61];
                StationNumber = 0;
                StationTRF = new char[51];
                StationName = new char[_MAX_STATION_NUMBER * 4];
                Station_X = new double[_MAX_STATION_NUMBER];
                Station_Y = new double[_MAX_STATION_NUMBER];
                Station_Z = new double[_MAX_STATION_NUMBER];
            }
        };

        /// <summary>
        /// 钟差数据
        /// </summary>
        public struct ClkData
        {
            //JD不用，只用其中的年月日时分秒                
            public UTCTime Epoch;
            //AR，地面站钟差
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_STATION_NUMBER)]
            public CLKDATA_Station[] StationData;
            //AS，卫星钟差    
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_SAT)]
            public CLKDATA_Sat[] SatData;
            //卫星钟差个数
            public int SatCount;
            //地面站钟差个数       
            public int StationCount;

            public ClkData(int satCount, int stationCount)
            {
                Epoch = new UTCTime();
                StationData = new CLKDATA_Station[_MAX_STATION_NUMBER];
                SatData = new CLKDATA_Sat[_MAX_SAT];
                SatCount = satCount;
                StationCount = stationCount;
            }
        };

        /// <summary>
        /// 监测站钟差数据 AR
        /// </summary>
        public struct CLKDATA_Station
        {
            //站名
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
            public char[] StationName;
            //1或2 
            public int flag;
            //钟差     
            public double Clk;
            //钟差精度   
            public double RMS_Clk;
        };

        /// <summary>
        /// 卫星钟差数据 AS
        /// </summary>
        public struct CLKDATA_Sat
        {
            //GPS:G;BD：C;
            public char SatType;

            public int SatPrn;
            //1或2 
            public int flag;
            //钟差      
            public double Clk;
            //钟差精度    
            public double RMS_Clk;
        };

        /// <summary>
        /// 整个钟差文件数据
        /// </summary>
        public struct ClkDataAll
        {
            // 钟文件头数据
            public ClkHead Hdr;
            //所有时刻的所有钟数据，每30S一组数据，一天最多2880组
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2880)]
            public ClkData[] Data;
            // 数据组数
            public int DataCount;

            public ClkDataAll(int count)
            {
                Hdr = new ClkHead(2.10,0,0);
                Data = new ClkData[2880];
                DataCount = count;
            }
        };
        #endregion

        #region SP3文件数据
        /// <summary>
        /// SP3头数据
        /// </summary>
        public struct SP3Head
        {
            //数据类型
            public char SP3Type;
            //轨道数据首历元,JD不用，只用其中的年月日时分秒，其他类似          
            public UTCTime InitTime;
            //采样率 一般为15分钟，即900秒
            public double SampPeriod;
            //卫星数
            public int SatCount;
            //轨道数据首历元的周计数
            public int InitWN;
            //轨道数据首历元的周内秒
            public double InitWeekSec;
            //轨道数据首历元约化儒略日的整数部分
            public int InitIntJD;
            //轨道数据首历元约化儒略日的小数部分
            public double InitDouJD;
            //总的历元数
            public int TotalEpoh;

            //数据处理所采用数据的类型
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
            public char[] DataType;
            //轨道数据所属坐标参照系
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
            public char[] Coordinate;
            //轨道类型             
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
            public char[] OrbitType;
            //发布轨道的机构
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
            public char[] Agent;
            //卫星编号
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_SAT)]
            public int[] SatPRN;
            //对应卫星的精度
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_SAT)]
            public int[] SatPrecision;
            /// <summary>
            /// 对应的卫星系统类型
            /// </summary>
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_SAT)]
            public char[] SatType;
            //系统类型，G:GPS;B:BD;
            public char SysType;

        };

        /// <summary>
        /// 单时刻所有卫星的Sp3数据
        /// </summary>
        public struct SP3Data
        {
            //轨道数据历元,JD不用，只用其中的年月日时分秒，其他类似 
            public UTCTime Epoch;
            //单时刻所有卫星数据
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_SAT)]
            public SP3REC[] Rec;
        };

        /// <summary>
        /// SP3单个数据
        /// </summary>
        public struct SP3REC
        {
            //p->0,v->1
            public char Flag;
            //卫星编号
            public int PRN;
            //卫星位置
            public double x, y, z;
            //钟改正，单位10^-6s
            public double dt;
        };

        /// <summary>
        /// 一天SP3文件中所有数据
        /// </summary>
        public struct SP3DataAll
        {
            // SP3头数据
            public SP3Head hdr;
            // 一天所有卫星的Sp3数据，15分钟一组数据，一天共96组数据
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 100)]
            public SP3Data[] data;
        };
        #endregion

        #region 导航电文数据
        /// <summary>
        /// 导航信息文件头数据
        /// </summary>
        public struct NavMessageHead
        {
            //版本号
            public double RnxVrsn;
            //文件类型      
            public char Type;
            //根据3.02版本重新定义导航卫星系统代码，G:GPS；R:GLONASS；E:Galileo；J:QZSS；C:BDS；S:SBAS Payload；M:Mixed                       
            public char SysType;
            //创建本数据文件所采用程序的名称
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 21)]
            public char[] PGM;
            //创建本数据文件单位的名称         
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 21)]
            public char[] Agent;
            //创建本数据文件的日期 
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
            public char[] CreateDate;
            //创建本数据文件的时间系统
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
            public char[] CreateDateType;
            //注释行
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 61)]
            public char[] CommentLine;
            //model=1,将电离层参数和时间参数写入文件；model=0,书写简易的文件头；
            public int Model;
            //历书中的电离层参数A0~A3
            public double A0, A1, A2, A3;
            //历书中的电离层参数B0~B3
            public double B0, B1, B2, B3;

            //时间修正类型:(9种)	不大于5个字符 
            //GPSA GPSB = GPS:	  alpha0-alpha3 or beta0-beta3
            //GAL	   = Galileo: ai0,ai1,ai2,zero
            //QZSA QZSB = QZS:	  alpha0-alpha3 or beta0-beta3
            //BDSA BDSB = BDS:	  alpha0-alpha3 or beta0-beta3
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
            public char[] TimeCorr;
            //GAUT = GAL to UTC a0,a1
            //GPUT = GPS to UTC a0,a1
            //SBUT = SBAS to UTC a0,a1
            //GLUT = GLO to UTC a0=TauC,a1=zero
            //GPGA = GPS to GAL a0=A0G,a1=A1G
            //GLGP = GLO to GPS a0=TauGPS,a1=zero
            //QZGP = QZS to GPS a0,a1
            //QZUT = QZS to UTC a0,a1
            //BDUT = BDS to UTC a0=A0UTC,a1=A1UTC
            //用于计算UTC时间的历书参数 
            //a0,a1: 多项式系数  
            public double a0, a1;
            //UTC数据参考时刻
            public int Time;
            // UTC参考周数 
            public int NumWeek;
            //跳秒(GPS或者BD系统)		            
            public int LeapSeconds;
            //Derived form MT17 service provider       
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
            public char[] SerProv;

            //UTC Identifier(0 if unknown)
            //1=UTC(NIST), 2=UTC(USNO), 3=UTC(SU), 4=UTC(BIPM), 5=UTC(Europe Lab),
            //6=UTC(CRL), 7=UTC(NTSC)(BDS), >7=not assigned yet        
            public int UTCIden;

            //LSF, WN_LSF和DN如果不知道，可以置0或空
            //Future or past leap seconds
            public int LSF;
            //Respective week number(continuous number)
            public int WN_LSF;
            //Respective day number DN
            public int DN;
        };

        /// <summary>
        /// 导航信息数据
        /// </summary>
        public struct NavMessage_Rinex
        {
            //卫星系统标识
            public char SysType;
            //卫星PRN号
            public int PRN;
            //卫星历元
            public UTCTime Epoch;
            //卫星钟的偏差，漂移，漂移速度
            public double a0, a1, a2;
            //广播轨道-1
            public double IODE_1, Crs_1, dn_1, M0_1;
            //广播轨道-2
            public double Cuc_2, e_2, Cus_2, sqtA_2;
            //广播轨道-3
            public double TOE_3, Cic_3, omega_3, Cis_3;
            //广播轨道-4
            public double i0_4, Crc_4, w_4, OMEGADOT_4;
            //广播轨道-5
            public double IDOT_5, L2_5, Wk_5, L2p_5;
            //广播轨道-6
            public double SatPrecisn_6, SatHealth_6, TGD_6, IODC_6;
            //广播轨道-7
            public double T_7, area_7, unknow1_7, unknow2_7;

            void NavCpy(ref NavMessage_Rinex Nav)
            {
                SysType = Nav.SysType;
                PRN = Nav.PRN;
                Epoch.year = Nav.Epoch.year;
                Epoch.mon = Nav.Epoch.mon;
                Epoch.day = Nav.Epoch.day;
                Epoch.hour = Nav.Epoch.hour;
                Epoch.min = Nav.Epoch.min;
                Epoch.sec = Nav.Epoch.sec;
                a0 = Nav.a0;
                a1 = Nav.a1;
                a2 = Nav.a2;
                IODE_1 = Nav.IODE_1;
                Crs_1 = Nav.Crs_1;
                dn_1 = Nav.dn_1;
                M0_1 = Nav.M0_1;
                Cuc_2 = Nav.Cuc_2;
                e_2 = Nav.e_2;
                Cus_2 = Nav.Cus_2;
                sqtA_2 = Nav.sqtA_2;
                TOE_3 = Nav.TOE_3;
                Cic_3 = Nav.Cic_3;
                omega_3 = Nav.omega_3;
                Cis_3 = Nav.Cis_3;
                i0_4 = Nav.i0_4;
                Crc_4 = Nav.Crc_4;
                w_4 = Nav.w_4;
                OMEGADOT_4 = Nav.OMEGADOT_4;
                IDOT_5 = Nav.IDOT_5;
                L2_5 = Nav.L2_5;
                Wk_5 = Nav.Wk_5;
                L2p_5 = Nav.L2p_5;
                SatPrecisn_6 = Nav.SatPrecisn_6;
                SatHealth_6 = Nav.SatHealth_6;
                TGD_6 = Nav.TGD_6;
                IODC_6 = Nav.IODC_6;
                T_7 = Nav.T_7;
                area_7 = Nav.area_7;
                unknow1_7 = Nav.unknow1_7;
                unknow2_7 = Nav.unknow2_7;
            }
            /// <summary>
            /// 从星历和钟差加载数据
            /// </summary>
            /// <param name="ephemeris_16"></param>
            /// <param name="clkErrFitMsg"></param>
            public void LoadData(Ephemeris_16 ephemeris_16, ClkErrFitMsg clkErrFitMsg)
            {
                //SysType = ephemeris_16;
                //PRN = Nav.PRN;
                Epoch.year = ephemeris_16.t.year;
                Epoch.mon = ephemeris_16.t.mon;
                Epoch.day = ephemeris_16.t.day;
                Epoch.hour = ephemeris_16.t.hour;
                Epoch.min = ephemeris_16.t.min;
                Epoch.sec = ephemeris_16.t.sec;
                a0 = clkErrFitMsg.a0;
                a1 = clkErrFitMsg.a1;
                a2 = clkErrFitMsg.a2;
                //IODE_1 = ephemeris_16.i;
                Crs_1 = ephemeris_16.Crs;
                dn_1 = ephemeris_16.deltaN;
                M0_1 = ephemeris_16.M;
                Cuc_2 = ephemeris_16.Cuc;
                e_2 = ephemeris_16.e;
                Cus_2 = ephemeris_16.Cus;
                sqtA_2 = ephemeris_16.sqrtA;
                TOE_3 = ephemeris_16.toe;
                Cic_3 = ephemeris_16.Cic;
                omega_3 = ephemeris_16.Omega0;
                Cis_3 = ephemeris_16.Cis;
                i0_4 = ephemeris_16.i;
                Crc_4 = ephemeris_16.Crc;
                w_4 = ephemeris_16.w;
                OMEGADOT_4 = ephemeris_16.OmegaDot;
                //IDOT_5 = ephemeris_16.idot;
                //L2_5 = ephemeris_16;
                //Wk_5 = ephemeris_16.Wk_5;
                //L2p_5 = ephemeris_16.L2p_5;
                //SatPrecisn_6 = ephemeris_16.SatPrecisn_6;
                //SatHealth_6 = ephemeris_16.SatHealth_6;
                //TGD_6 = ephemeris_16.TGD_6;
                //IODC_6 = ephemeris_16.IODC_6;
                //T_7 = ephemeris_16.T_7;
                //area_7 = ephemeris_16.area_7;
                //unknow1_7 = ephemeris_16.unknow1_7;
                //unknow2_7 = ephemeris_16.unknow2_7;
            }
        };

        /// <summary>
        /// 整个导航电文文件数据
        /// </summary>
        public struct NavMsgAll
        {
            //导航电文头数据
            public NavMessageHead Head;
            //整个导航电文文件数据
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_SAT_VISIBLE * 12)]
            public NavMessage[] Data;
        };
        #endregion

        #region 观测数据
        /// <summary>
        /// 观测值文件头
        /// </summary>
        public struct ObserveHead
        {
            //RINEX格式的版本号   
            public double Versn;
            //文件类型		                
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_LEN_TEMP)]
            public char[] FileType;
            //【V2.10】观测数据所属卫星系统:
            //----空格或G为GPS,
            //----R为GLONASS,
            //----S为地球同步卫星信号载荷
            //----T为NNSS子午卫星，
            //----M为混合系统	 
            //【V3.02】观测数据所属卫星系统:
            //----G:GPS,
            //----R:GLONASS,
            //----E:Galileo,
            //----J:QZSS,
            //----C:BDS
            //----S:SBAS payload
            //----M:Mixed
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_LEN_TEMP)]
            public char[] SatSystemType;


            //创建本数据文件所采用程序的名称  
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_LEN_TEMP)]
            public char[] Pgm;
            //创建本数据文件单位的名称
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_LEN_TEMP)]
            public char[] Runby;
            //创建本数据文件的日期
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_LEN_TEMP)]
            public char[] CreateDate;
            //测站名 
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_RNX_MARK_NAME)]
            public char[] MarkName;
            //测站号 
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_RNX_MARK_NUMBER)]
            public char[] MarkNum;
            //观测员姓名
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_RNX_MARK_NAME)]
            public char[] ObserverName;
            //观测单位名称
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_RNX_MARK_NAME)]
            public char[] ObserverAgency;
            //接收机号 
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_RNX_RCVR_SN)]
            public char[] RecvSN;
            //接收机类型 
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_RNX_RCVR_TYPE)]
            public char[] RecvType;
            //接收机版本号
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_RNX_RCVR_VER)]
            public char[] RecvVersn;
            //天线号
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_RNX_ANT_SN)]
            public char[] AntSN;

            //天线类型
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_RNX_ANT_TYPE)]
            public char[] AntType;
            //测站近似坐标  地固近似坐标(V2.10为WGS84)，单位为米      
            public CrdCartestian ApproxPos;
            //天线相位中心偏移量    
            //----天线高(高于标志的天线下表面高度)
            //----天线中心相对于标志在东向和北向上的偏移量
            public CrdTopocentric AntDelta;

            //【V3.02】天线相位中心偏移量(XYZ)
            public CrdCartestian AntDelta_XYZ;
            //波长     
            public int WaveLen_L1, WaveLen_L2;
            //观测值类型数 	                    
            public int ObsvTypeCount;
            //观测值类型
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 50 * 6)]
            public char[] ObsvType;

            //采样间隔间隔(s)
            public double Intval;
            //首次观测时间             
            public UTCTime FrstObsvTime;
            //最后观测时间       
            public UTCTime LastObsvTime;
            //首次观测时间和最后观测时间的时间系统类型
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
            public char[] TimeSystem;
            //跳秒    
            public int LeapSec;
            //判断历元时标、码伪距和载波相位是否使用实时确定出的接收机钟偏差进行了改正：1=是，0=否；缺省值：0=否； 		      
            public int ClockCorrectFlag;
            //【V3.02】 观测类型描述 
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 7)]
            public ObsDescriptor_v302[] obsvdescrip_V302;
            public int _t_LSF;
            public int WN_LSF;
            public int DN;
        };

        /// <summary>
        /// 三维坐标(笛卡尔坐标系)
        /// </summary>
        public struct CrdCartestian
        {
            public double x;
            public double y;
            public double z;
        };

        /// <summary>
        /// 三维坐标(H,E,N方向)
        /// </summary>
        public struct CrdTopocentric
        {
            public double H;
            public double E;
            public double N;
        };

        /// <summary>
        /// 多颗卫星GPS观测值 v3.02
        /// </summary>
        public struct ObsDescriptor_v302
        {
            //卫星系统编码（G/R/E/J/C/S/M） 
            public char SatSysCode;
            //该卫星系统的观测类型数
            public int ObsvTypCount;
            //该卫星系统的观测类型列表
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20 * 4)]
            public char[] ObsvDescrip;
        };

        /// <summary>
        /// 多颗卫星GPS观测值
        /// </summary>
        public struct ObserveData
        {
            //观测数据文件头数据
            public GMORECHDR hdr;
            //观测数据文件数据
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_SAT_VISIBLE)]
            public SatOBS[] Sta2SatObsData;
        };

        /// <summary>
        /// 观测值记录头
        /// </summary>
        public struct GMORECHDR
        {
            // 历元时刻
            public UTCTime Epoch;
            // 星历标志
            public uint NavMsgFlag;
            // 卫星数
            public uint SatCount;
            //【V2.10】标记观测的卫星的类型
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_SAT_VISIBLE)]
            public char[] SatFlag;
            //【V2.10】卫星列表
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_SAT_VISIBLE)]
            public int[] Prn;
            //接收机式中的偏差
            public double RecvBia;
        };

        /// <summary>
        /// 单颗卫星GPS观测值
        /// </summary>
        public struct SatOBS
        {
            // 观测值的数值
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_CNT_OBS_TYPE)]
            public double[] ObsValue;
            // 失锁标识符
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_CNT_OBS_TYPE)]
            public uint[] LosingLockIdentifier;
            // Signal Strength 
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_CNT_OBS_TYPE)]
            public uint[] SignalStrength;

        };

        /// <summary>
        /// 多颗卫星GPS观测值 v3.02
        /// </summary>
        public struct ObserveData_v302
        {
            //观测数据文件头数据
            public GMORECHDR hdr;
            //卫星系统编码（G/R/E/J/C/S/M） 
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_SAT_VISIBLE)]
            public char[] SatSysCode;
            //卫星编号
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_SAT_VISIBLE)]
            public int[] SatID;
            //观测数据文件数据
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_SAT_VISIBLE)]
            public SatOBS_v302[] Sta2SatObsData;
        };

        /// <summary>
        /// 单颗卫星GPS观测值 v3.02
        /// </summary>
        public struct SatOBS_v302
        {
            // 观测值的数值
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_CNT_OBS_TYPE_V302)]
            public double[] ObsValue;
            // 失锁标识符
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_CNT_OBS_TYPE_V302)]
            public uint[] LosingLockIdentifier;
            // Signal Strength
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = _MAX_CNT_OBS_TYPE_V302)]
            public uint[] SignalStrength;
        };

        /// <summary>
        /// 读文件用的结构体
        /// </summary>
        public struct ObsDataAll_v210
        {
            // 观测值文件头
            public ObserveHead Hdr;
            // 多颗卫星GPS观测值
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3000)]
            public ObserveData[] ObsData;
        };

        /// <summary>
        /// 读文件用的结构体
        /// </summary>
        public struct ObsDataAll_v302
        {
            // 观测值文件头
            public ObserveHead Hdr;
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3000)]
            // 多颗卫星GPS观测值 v3.02
            public ObserveData_v302[] ObsData;
        }
        #endregion

        #region 初始化函数
        /// <summary>
        /// 初始化钟差文件头
        /// 钟差只有V3.00版本
        /// </summary>
        /// <param name="initTime">初始化时间</param>
        /// <param name="clkHead">钟差文件头结构</param>
        public static void InitClkFileHead(UTCTime initTime, ref ClkHead clkHead)
        {
            clkHead.Version = 3.0;
            string Progm = "BDSim";//长度小于21
            string Agent = "Sirc"; //长度小于21
            string creatTime = DateTime.Now.ToString("yyyyMMdd HHmmss");
            clkHead.Pgm = new char[21];
            clkHead.agent = new char[21];
            clkHead.CreateDate = new char[21];
            if (Progm.ToCharArray().Length < 21)
            {
                System.Array.Copy(Progm.ToCharArray(), clkHead.Pgm, Progm.ToCharArray().Length);
            }
            if (Agent.ToCharArray().Length < 21)
            {
                System.Array.Copy(Agent.ToCharArray(), clkHead.agent, Agent.ToCharArray().Length);
            }
            if (creatTime.ToCharArray().Length < 21)
            {
                System.Array.Copy(creatTime.ToCharArray(), clkHead.CreateDate, Agent.ToCharArray().Length);
            }
            clkHead.LeapSeconds = 16;
            clkHead.TypeNumber = 0;
            clkHead.AnalysisCenter = new char[61];


            //clkHead.SysType = 'C';
        }

        /// <summary>
        /// 初始化SP3文件
        /// </summary>
        /// <param name="initTime">初始化时间</param>
        /// <param name="sp3Head">SP3文件头结构</param>
        public static void InitSP3FileHead(UTCTime initTime, ref SP3Head sp3Head)
        {
            //类型
            sp3Head.SP3Type = 'P';
            //轨道数据首历元
            sp3Head.InitTime.year = initTime.Year;
            sp3Head.InitTime.mon = initTime.Mon;
            sp3Head.InitTime.day = initTime.Day;
            sp3Head.InitTime.hour = initTime.Hour;
            sp3Head.InitTime.min = initTime.Min;
            sp3Head.InitTime.sec = initTime.Sec;
            //采样率 一般为15分钟，即900秒
            sp3Head.SampPeriod = 0.0;
            //sp3Head.TotalEpoh = 96;

            //数据处理所采用数据的类型
            sp3Head.DataType = new char[6];
            sp3Head.DataType[0] = 'O';
            sp3Head.DataType[1] = 'R';
            sp3Head.DataType[2] = 'B';
            sp3Head.DataType[3] = 'I';
            sp3Head.DataType[4] = 'T';
            sp3Head.DataType[5] = '\0';
            //轨道数据所属坐标参照系
            sp3Head.Coordinate = new char[6];
            sp3Head.Coordinate[0] = ' ';
            sp3Head.Coordinate[1] = 'I';
            sp3Head.Coordinate[2] = 'T';
            sp3Head.Coordinate[3] = 'R';
            sp3Head.Coordinate[4] = 'F';
            sp3Head.Coordinate[5] = '\0';
            //轨道类型
            sp3Head.OrbitType = new char[4];
            sp3Head.OrbitType[0] = 'F';
            sp3Head.OrbitType[1] = 'I';
            sp3Head.OrbitType[2] = 'T';
            sp3Head.OrbitType[3] = '\0';
            //发布轨道的机构
            sp3Head.Agent = new char[5];
            sp3Head.Agent[0] = 'B';
            sp3Head.Agent[1] = 'D';
            sp3Head.Agent[2] = 'T';
            sp3Head.Agent[3] = 'H';
            sp3Head.Agent[4] = '\0';
            //系统类型，G:GPS;B:BD;
            sp3Head.SysType = 'C';
            //对应卫星的精度
            sp3Head.SatPrecision = new Int32[85];
            //卫星编号
            sp3Head.SatPRN = new int[85];
            for (int i = 0; i < 85; i++)
            {
                sp3Head.SatPrecision[i] = 0;
                sp3Head.SatPRN[i] = 0;
            }
        }

        /// <summary>
        /// 初始化观测数据文件V2.10
        /// </summary>
        /// <param name="observeHead">观测数据文件头结构</param>
        public static void InitObserveFileHead_V210(ref ObserveHead observeHead, char SatSysType)
        {
            //RINEX格式的版本号
            observeHead.Versn = 2.10;
            //文件类型
            observeHead.FileType = new char[_MAX_LEN_TEMP];
            for (int iNameLen = 0; iNameLen < _MAX_LEN_TEMP; iNameLen++)
            {
                observeHead.FileType[iNameLen] = '\0';
            }
            //创建本数据文件所采用程序的名称
            observeHead.Pgm = new char[_MAX_LEN_TEMP];
            for (int iNameLen = 0; iNameLen < _MAX_LEN_TEMP; iNameLen++)
            {
                observeHead.Pgm[iNameLen] = '\0';
            }
            //创建本数据文件单位的名称
            observeHead.Runby = new char[_MAX_LEN_TEMP];
            for (int iNameLen = 0; iNameLen < _MAX_LEN_TEMP; iNameLen++)
            {
                observeHead.Runby[iNameLen] = '\0';
            }
            //创建本数据文件的日期
            observeHead.CreateDate = new char[_MAX_LEN_TEMP];
            for (int iNameLen = 0; iNameLen < _MAX_LEN_TEMP; iNameLen++)
            {
                observeHead.CreateDate[iNameLen] = '\0';
            }
            //测站名
            observeHead.MarkName = new char[_MAX_RNX_MARK_NAME];
            for (int iMarkNum = 0; iMarkNum < _MAX_RNX_MARK_NAME; iMarkNum++)
            {
                observeHead.MarkName[iMarkNum] = '\0';
            }
            //测站号 
            observeHead.MarkNum = new char[_MAX_RNX_MARK_NUMBER];
            for (int iMarkNum = 0; iMarkNum < _MAX_RNX_MARK_NUMBER; iMarkNum++)
            {
                observeHead.MarkNum[iMarkNum] = '\0';
            }
            //观测员姓名
            observeHead.ObserverName = new char[_MAX_RNX_MARK_NAME];
            //观测单位名称
            observeHead.ObserverAgency = new char[_MAX_RNX_MARK_NAME];
            //接收机号
            observeHead.RecvSN = new char[_MAX_RNX_RCVR_SN];
            for (int iRcvrSN = 0; iRcvrSN < _MAX_RNX_RCVR_SN; iRcvrSN++)
            {
                observeHead.RecvSN[iRcvrSN] = '\0';
            }
            //接收机类型
            observeHead.RecvType = new char[_MAX_RNX_RCVR_TYPE];
            for (int iRcvrTYPE = 0; iRcvrTYPE < _MAX_RNX_RCVR_TYPE; iRcvrTYPE++)
            {
                observeHead.RecvType[iRcvrTYPE] = '\0';
            }
            //接收机版本号
            observeHead.RecvVersn = new char[_MAX_RNX_RCVR_VER];
            for (int iRcvrVER = 0; iRcvrVER < _MAX_RNX_RCVR_VER; iRcvrVER++)
            {
                observeHead.RecvVersn[iRcvrVER] = '\0';
            }
            //天线号
            observeHead.AntSN = new char[_MAX_RNX_ANT_SN];
            for (int iAntSN = 0; iAntSN < _MAX_RNX_ANT_SN; iAntSN++)
            {
                observeHead.AntSN[iAntSN] = '\0';
            }
            //天线类型
            observeHead.AntType = new char[_MAX_RNX_ANT_TYPE];
            for (int iAntType = 0; iAntType < _MAX_RNX_ANT_TYPE; iAntType++)
            {
                observeHead.AntType[iAntType] = '\0';
            }
            observeHead.obsvdescrip_V302 = new ObsDescriptor_v302[7];
            observeHead.obsvdescrip_V302[0].SatSysCode = SatSysType;
            observeHead.obsvdescrip_V302[0].ObsvDescrip = new char[20 * 4];
            switch (observeHead.obsvdescrip_V302[0].SatSysCode)
            {

                case 'G':
                    observeHead.obsvdescrip_V302[0].ObsvTypCount = 9;
                    string strGPSObsType = "C1\0\0C2\0\0C5\0\0L1\0\0L2\0\0L5\0\0D1\0\0D2\0\0D5";
                    System.Array.Copy(strGPSObsType.ToCharArray(), observeHead.obsvdescrip_V302[0].ObsvDescrip, strGPSObsType.ToCharArray().Length);
                    break;
                case 'C':
                    observeHead.obsvdescrip_V302[0].ObsvTypCount = 9;
                    string strBeiDouObsType = "C1\0\0C7\0\0C6\0\0L1\0\0L7\0\0L6\0\0D1\0\0D7\0\0D6";
                    System.Array.Copy(strBeiDouObsType.ToCharArray(), observeHead.obsvdescrip_V302[0].ObsvDescrip, strBeiDouObsType.ToCharArray().Length);
                    break;
                case 'R':
                    observeHead.obsvdescrip_V302[0].ObsvTypCount = 6;
                    string strGlonassObsType = "C1\0\0C2\0\0L1\0\0L2\0\0D1\0\0D2";
                    System.Array.Copy(strGlonassObsType.ToCharArray(), observeHead.obsvdescrip_V302[0].ObsvDescrip, strGlonassObsType.ToCharArray().Length);
                    break;
                case 'E':
                    observeHead.obsvdescrip_V302[0].ObsvTypCount = 9;
                    string strGalieoObsType = "C1\0\0C5\0\0C6\0\0L1\0\0L5\0\0L6\0\0D1\0\0D5\0\0D6";
                    System.Array.Copy(strGalieoObsType.ToCharArray(), observeHead.obsvdescrip_V302[0].ObsvDescrip, strGalieoObsType.ToCharArray().Length);
                    break;
                default:
                    break;
            }


            observeHead.SatSystemType = new char[_MAX_LEN_TEMP];
            observeHead.TimeSystem = new char[6];
            //observeHead.obsvdescrip_V302 = new ObsDescriptor_v302[7];
            //for (int index = 0; index < 7; index++)
            //{
            //    observeHead.obsvdescrip_V302[index].ObsvDescrip = new char[20 * 4];
            //}
            observeHead.ObsvType = new char[300];
            string Progm = "BDSim";//长度小于_MAX_LEN_TEMP
            string Agent = "Sirc"; //长度小于_MAX_LEN_TEMP
            if (Progm.ToCharArray().Length < _MAX_LEN_TEMP)
            {
                System.Array.Copy(Progm.ToCharArray(), observeHead.Pgm, Progm.ToCharArray().Length);
            }
            if (Agent.ToCharArray().Length < _MAX_LEN_TEMP)
            {
                System.Array.Copy(Agent.ToCharArray(), observeHead.Runby, Agent.ToCharArray().Length);
            }
            //add by kj   
            string FileType = "OBSERVATION DATA";
            if (FileType.ToArray().Length < observeHead.FileType.Length)
            {
                System.Array.Copy(FileType.ToArray(), observeHead.FileType, FileType.ToArray().Length);
            }
            observeHead.ApproxPos.x = 0.0;
            observeHead.ApproxPos.y = 0.0;
            observeHead.ApproxPos.z = 0.0;
            observeHead.AntDelta.H = 0.0;
            observeHead.AntDelta.N = 0.0;
            observeHead.AntDelta.E = 0.0;
            observeHead.WaveLen_L1 = 0;
            observeHead.WaveLen_L2 = 0;
            observeHead.ObsvTypeCount = 0;
            observeHead.Intval = 0;
            observeHead.FrstObsvTime.year = 0;
            observeHead.FrstObsvTime.mon = 0;
            observeHead.FrstObsvTime.day = 0;
            observeHead.FrstObsvTime.hour = 0;
            observeHead.FrstObsvTime.min = 0;
            observeHead.FrstObsvTime.sec = 0;

            observeHead.LastObsvTime.year = 0;
            observeHead.LastObsvTime.mon = 0;
            observeHead.LastObsvTime.day = 0;
            observeHead.LastObsvTime.hour = 0;
            observeHead.LastObsvTime.min = 0;
            observeHead.LastObsvTime.sec = 0;
            observeHead.LeapSec = 0;
        }

        /// <summary>
        /// 初始化观测数据文件V3.02
        /// </summary>
        /// <param name="observeHead">观测数据文件头结构</param>
        public static void InitObserveFileHead_V302(ref ObserveHead observeHead)
        {
            observeHead.Versn = 3.02;

            observeHead.FileType = new char[_MAX_LEN_TEMP];
            for (int iNameLen = 0; iNameLen < _MAX_LEN_TEMP; iNameLen++)
            {
                observeHead.FileType[iNameLen] = '\0';
            }
            observeHead.Pgm = new char[_MAX_LEN_TEMP];
            for (int iNameLen = 0; iNameLen < _MAX_LEN_TEMP; iNameLen++)
            {
                observeHead.Pgm[iNameLen] = '\0';
            }
            observeHead.Runby = new char[_MAX_LEN_TEMP];
            for (int iNameLen = 0; iNameLen < _MAX_LEN_TEMP; iNameLen++)
            {
                observeHead.Runby[iNameLen] = '\0';
            }
            observeHead.CreateDate = new char[_MAX_LEN_TEMP];
            for (int iNameLen = 0; iNameLen < _MAX_LEN_TEMP; iNameLen++)
            {
                observeHead.CreateDate[iNameLen] = '\0';
            }
            observeHead.MarkName = new char[_MAX_RNX_MARK_NAME];
            for (int iMarkNum = 0; iMarkNum < _MAX_RNX_MARK_NAME; iMarkNum++)
            {
                observeHead.MarkName[iMarkNum] = '\0';
            }

            observeHead.MarkNum = new char[_MAX_RNX_MARK_NUMBER];
            for (int iMarkNum = 0; iMarkNum < _MAX_RNX_MARK_NUMBER; iMarkNum++)
            {
                observeHead.MarkNum[iMarkNum] = '\0';
            }
            observeHead.RecvSN = new char[_MAX_RNX_RCVR_SN];
            for (int iRcvrSN = 0; iRcvrSN < _MAX_RNX_RCVR_SN; iRcvrSN++)
            {
                observeHead.RecvSN[iRcvrSN] = '\0';
            }
            observeHead.RecvType = new char[_MAX_RNX_RCVR_TYPE];
            for (int iRcvrTYPE = 0; iRcvrTYPE < _MAX_RNX_RCVR_TYPE; iRcvrTYPE++)
            {
                observeHead.RecvType[iRcvrTYPE] = '\0';
            }
            observeHead.RecvVersn = new char[_MAX_RNX_RCVR_VER];
            for (int iRcvrVER = 0; iRcvrVER < _MAX_RNX_RCVR_VER; iRcvrVER++)
            {
                observeHead.RecvVersn[iRcvrVER] = '\0';
            }
            observeHead.AntSN = new char[_MAX_RNX_ANT_SN];
            for (int iAntSN = 0; iAntSN < _MAX_RNX_ANT_SN; iAntSN++)
            {
                observeHead.AntSN[iAntSN] = '\0';
            }
            observeHead.AntType = new char[_MAX_RNX_ANT_TYPE];
            for (int iAntType = 0; iAntType < _MAX_RNX_ANT_TYPE; iAntType++)
            {
                observeHead.AntType[iAntType] = '\0';
            }

            observeHead.ObserverAgency = new char[_MAX_RNX_MARK_NUMBER];
            observeHead.ObserverName = new char[_MAX_RNX_MARK_NAME];
            observeHead.SatSystemType = new char[_MAX_LEN_TEMP];
            observeHead.TimeSystem = new char[6];
            observeHead.obsvdescrip_V302 = new ObsDescriptor_v302[7];
            for (int index = 0; index < 7; index++)
            {
                observeHead.obsvdescrip_V302[index].ObsvDescrip = new char[20 * 4];
                //observeHead.obsvdescrip_V302[index].SatSysCode = 'C';
            }
            observeHead.ObsvType = new char[300];
            observeHead.SatSystemType[0] = 'C';
            observeHead.obsvdescrip_V302[0].SatSysCode = 'C';
            observeHead.obsvdescrip_V302[0].ObsvTypCount = 6;
            observeHead.obsvdescrip_V302[0].ObsvDescrip[0] = 'B';
            observeHead.obsvdescrip_V302[0].ObsvDescrip[1] = '1';

            observeHead.obsvdescrip_V302[0].ObsvDescrip[4] = 'B';
            observeHead.obsvdescrip_V302[0].ObsvDescrip[5] = '2';

            observeHead.obsvdescrip_V302[0].ObsvDescrip[8] = 'B';
            observeHead.obsvdescrip_V302[0].ObsvDescrip[9] = '3';

            observeHead.obsvdescrip_V302[0].ObsvDescrip[12] = 'M';
            observeHead.obsvdescrip_V302[0].ObsvDescrip[12] = '1';

            observeHead.obsvdescrip_V302[0].ObsvDescrip[14] = 'M';
            observeHead.obsvdescrip_V302[0].ObsvDescrip[15] = '1';

            observeHead.obsvdescrip_V302[0].ObsvDescrip[20] = 'M';
            observeHead.obsvdescrip_V302[0].ObsvDescrip[21] = '1';



            string FileType = "O:GNSS OBS DATA";//长度小于_MAX_LEN_TEMP
            if (FileType.ToCharArray().Length < _MAX_LEN_TEMP)
            {
                System.Array.Copy(FileType.ToCharArray(), observeHead.FileType, FileType.ToCharArray().Length);
            }
            string Progm = "BDSim";//长度小于_MAX_LEN_TEMP
            if (Progm.ToCharArray().Length < _MAX_LEN_TEMP)
            {
                System.Array.Copy(Progm.ToCharArray(), observeHead.Pgm, Progm.ToCharArray().Length);
            }
            string Agent = "Sirc"; //长度小于_MAX_LEN_TEMP
            if (Agent.ToCharArray().Length < _MAX_LEN_TEMP)
            {
                System.Array.Copy(Agent.ToCharArray(), observeHead.Runby, Agent.ToCharArray().Length);
            }
            observeHead.ApproxPos.x = 0.0;
            observeHead.ApproxPos.y = 0.0;
            observeHead.ApproxPos.z = 0.0;
            observeHead.AntDelta.H = 0.0;
            observeHead.AntDelta.N = 0.0;
            observeHead.AntDelta.E = 0.0;
            observeHead.WaveLen_L1 = 0;
            observeHead.WaveLen_L2 = 0;
            observeHead.ObsvTypeCount = 0;
            observeHead.Intval = 0;
            observeHead.FrstObsvTime.year = 0;
            observeHead.FrstObsvTime.mon = 0;
            observeHead.FrstObsvTime.day = 0;
            observeHead.FrstObsvTime.hour = 0;
            observeHead.FrstObsvTime.min = 0;
            observeHead.FrstObsvTime.sec = 0;

            observeHead.LastObsvTime.year = 0;
            observeHead.LastObsvTime.mon = 0;
            observeHead.LastObsvTime.day = 0;
            observeHead.LastObsvTime.hour = 0;
            observeHead.LastObsvTime.min = 0;
            observeHead.LastObsvTime.sec = 0;
            observeHead.LeapSec = 0;
        }

        /// <summary>
        /// 初始化导航电文文件V2.10
        /// </summary>
        /// <param name="navMessageHead">导航电文文件头结构</param>
        public static void InitNavMesgFileHeadV210(ref NavMessageHead navMessageHead)
        {
            navMessageHead.RnxVrsn = 2.10;
            navMessageHead.Type = 'N';
            navMessageHead.SysType = 'C';
            navMessageHead.PGM = new char[21];
            navMessageHead.Agent = new char[21];
            string Progm = "BDSim";//长度小于21
            string Agent = "Sirc"; //长度小于21
            navMessageHead.PGM = new char[21];
            navMessageHead.Agent = new char[21];
            if (Progm.ToCharArray().Length < 21)
            {
                System.Array.Copy(Progm.ToCharArray(), navMessageHead.PGM, Progm.ToCharArray().Length);
            }
            if (Agent.ToCharArray().Length < 21)
            {
                System.Array.Copy(Agent.ToCharArray(), navMessageHead.Agent, Agent.ToCharArray().Length);
            }

            navMessageHead.CreateDateType = new char[5];
            navMessageHead.CommentLine = new char[61];
            navMessageHead.Model = 1;
            //navMessageHead.A0 = 0;
            //navMessageHead.A1 = 0;
            //navMessageHead.A2 = 0;
            //navMessageHead.A3 = 0;
            //navMessageHead.B0 = 0;
            //navMessageHead.B1 = 0;
            //navMessageHead.B2 = 0;
            //navMessageHead.B3 = 0;
            navMessageHead.TimeCorr = new char[5];
            navMessageHead.a0 = 0.0;
            navMessageHead.a1 = 0.0;
            navMessageHead.Time = 0;
            navMessageHead.NumWeek = 0;
            navMessageHead.LeapSeconds = 0;
            navMessageHead.SerProv = new char[6];
            navMessageHead.UTCIden = 0;
            navMessageHead.LSF = 0;
            navMessageHead.WN_LSF = 0;
            navMessageHead.DN = 0;
        }

        /// <summary>
        /// 初始化导航电文文件V3.02
        /// </summary>
        /// <param name="navMessageHead">导航电文文件头结构</param>
        public static void InitNavMesgFileHeadV302(ref NavMessageHead navMessageHead)
        {
            navMessageHead.RnxVrsn = 3.02;
            navMessageHead.Type = 'N';
            navMessageHead.SysType = 'C';
            navMessageHead.PGM = new char[21];
            navMessageHead.Agent = new char[21];
            string Progm = "BDSim";//长度小于21
            string Agent = "Sirc"; //长度小于21
            navMessageHead.PGM = new char[21];
            navMessageHead.Agent = new char[21];
            if (Progm.ToCharArray().Length < 21)
            {
                System.Array.Copy(Progm.ToCharArray(), navMessageHead.PGM, Progm.ToCharArray().Length);
            }
            if (Agent.ToCharArray().Length < 21)
            {
                System.Array.Copy(Agent.ToCharArray(), navMessageHead.Agent, Agent.ToCharArray().Length);
            }

            navMessageHead.CreateDateType = new char[5];
            navMessageHead.CreateDateType[0] = 'U';
            navMessageHead.CreateDateType[1] = 'T';
            navMessageHead.CreateDateType[2] = 'C';
            navMessageHead.CommentLine = new char[61];
            navMessageHead.Model = 1;
            //navMessageHead.A0 = 0;
            //navMessageHead.A1 = 0;
            //navMessageHead.A2 = 0;
            //navMessageHead.A3 = 0;
            //navMessageHead.B0 = 0;
            //navMessageHead.B1 = 0;
            //navMessageHead.B2 = 0;
            //navMessageHead.B3 = 0;
            navMessageHead.TimeCorr = new char[5];
            navMessageHead.a0 = 0.0;
            navMessageHead.a1 = 0.0;
            navMessageHead.Time = 0;
            navMessageHead.NumWeek = 0;
            navMessageHead.LeapSeconds = 0;
            navMessageHead.SerProv = new char[6];
            navMessageHead.UTCIden = 0;
            navMessageHead.LSF = 0;
            navMessageHead.WN_LSF = 0;
            navMessageHead.DN = 0;
        }
        #endregion


    }
}
